package vip.gadfly.tiktok.mini.api;

import vip.gadfly.tiktok.mini.bean.oauth2.TtMiniAccessTokenResult;
import vip.gadfly.tiktok.mini.bean.userinfo.TtMiniFansListResult;
import vip.gadfly.tiktok.mini.bean.userinfo.TtMiniUserDataRequest;
import vip.gadfly.tiktok.mini.bean.userinfo.TtMiniVideoListResult;
import vip.gadfly.tiktok.open.bean.userinfo.*;

/**
 * 小程序API接口
 * @author Gadfly
 * @since 2021-09-30 10:27
 */
public interface TtMiniUserInfoService {


    /**
     * 抖音token授权-1-新接口-tt.showDouyinOpenAuth：code
     * 小程序code换openid
     * @param authorizationCode
     * @return access_token 调用其他接口用
     * "data": {
     *         "access_token": "act.3.QOa1EQPHGn-xE_fAibH4hnK9rVBGXERozjkTn7MpbjpMFFY_vK6j_s-ZsxT4L-Ggl4yLvkdQH0_zP6nxaJyV1rSCWXcBAUN1zePkwix4FeASOSEg-LNZYkpCqo7t5U9tyfzgBEZm3yrZytjhYzBzKLcMXmDQJYuf5XE4VGWzAlGLLYmA8iHYFld7wB8=",
     *         "captcha": "",
     *         "desc_url": "",
     *         "description": "",
     *         "error_code": 0,
     *         "expires_in": 1296000,
     *         "log_id": "202308151546234D527F1F0D96C2030760",
     *         "open_id": "_000GO05zX8abZtqy34fa0eDVAW3pLthGygS",
     *         "refresh_expires_in": 2592000,
     *         "refresh_token": "rft.55886e78f7a51abbea8364905fba8468TTfsBGTnyOR2LOARgmF6eizWjhEW",
     *         "scope": "basic_bc,data.external.user"
     *     },
     */
    TtMiniAccessTokenResult getAccessTokenByAuthorizationCode(String authorizationCode);

    /**
     *
     * 抖音token授权后登录-tt.login 产生的：code 换openid
     * @param code
     * @return "data": {
     *         "session_key": "3+yW2gPwGe+r9pEFrtIgRA==",
     *         "openid": "_000GO05zX8abZtqy34fa0eDVAW3pLthGygS",
     *         "anonymous_openid": "",
     *         "unionid": "57eff274-105b-42a4-9c06-2062e0bafab9",
     *         "dopenid": ""
     *     }
     */
    TtMiniAccessTokenResult getMiniUserLogin(String code);



//    TtOpUserInfoResult getMiniUserInfo(String openId, TtMiniUserDataRequest request);

    /**
     *  取用户视频信息: 要accesstoken 依赖getMiniUserLogin
     * @param openId 通过/oauth/access_token/获取，用户唯一标志
     * @param dateType 近7/15天；输入7代表7天、15代表15天、30代表30天
     * @return
     */
    TtMiniVideoListResult getExternalList(String openId, Integer dateType);

    /**
     * 获取粉丝列表
     *
     * @param openId openid
     * @param dateType 近7/15天；输入7代表7天、15代表15天、30代表30天
     * @return 结果
     */
    TtMiniFansListResult getFansList(String openId, Integer dateType);

    /**
     * 获取关注列表
     *
     * @param openId openid
     * @param cursor 游标
     * @param count  数量
     * @return 结果
     */
    TtOpFollowingListResult getFollowingList(String openId, Long cursor, Integer count);

    /**
     * 粉丝判断
     *
     * @param openId         openid
     * @param followerOpenId 粉丝openid
     * @return 结果
     */
    TtOpFansCheckResult getFansCheck(String openId, String followerOpenId);
}
